package com.thlws.study.kafka.controller;

import com.thlws.study.kafka.mq.KafKaProducer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author HanleyTang 2019-08-14
 */
@Slf4j
@RestController
public class IndexController {

    @Autowired
    private KafKaProducer producer;

    /***
     * 发送消息体为基本类型的消息
     */
    @GetMapping("/")
    public void sendSimple() {
        log.info("准备开始发送数据 IndexController.sendSimple");
        producer.sendMessage("logs", "hello spring boot kafka,"+System.currentTimeMillis());
    }
}
